#include<bits/stdc++.h>
using namespace std;
#define int long long

int s[25][25][25];
int a[10];

signed main() {
	int w, x, h, q;
	cin >> w >> x >> h >> q;
	for (int i = 1; i <= w; i++) {
		for (int j = 1; j <= x; j++) {
			for (int k = 1; k <= h; k++) {
				s[i][j][k] = 1;
			}
		}
	}
	while (q--) {
		for (int i = 1; i <= 6; i++)
			cin >> a[i];

		for (int i = a[1]; i <= a[4]; i++) {
			for (int j = a[2]; j <= a[5]; j++) {
				for (int k = a[3]; k <= a[6]; k++) {
					s[i][j][k] = 0;
				}
			}
		}
	}

	int ans = 0;
	for (int i = 1; i <= w; i++) {
		for (int j = 1; j <= x; j++) {
			for (int k = 1; k <= h; k++) {
				if (s[i][j][k])
					ans++;
			}
		}
	}
	cout << ans;
	return 0;
}
